// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_PUR_REJECTED_ORDER_ITEM
// * CreateDate    : 2011/8/16 10:16:41
// * Creater       : CodeSmith
// * LastChangeDate: 2011/8/16 10:16:41
// * LastChanger   : 2011/8/16 10:16:41
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;

namespace ESOL.Business.Pur
{
/// <summary>
    /// PurRejectedOrderItem
    /// </summary>
    public partial class PurRejectedOrderItemBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objPurRejectedOrderItemEntity">Entity</param>
        /// <returns>Entity</returns>
        public static PurRejectedOrderItemEntity GetPurRejectedOrderItem(PurRejectedOrderItemEntity objPurRejectedOrderItemEntity)
        {
            return DataAccess.SelectSingle<PurRejectedOrderItemEntity>(objPurRejectedOrderItemEntity);
        }
        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objPurRejectedOrderItemEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertPurRejectedOrderItem(PurRejectedOrderItemEntity objPurRejectedOrderItemEntity)
        {
            return DataAccess.Insert(objPurRejectedOrderItemEntity);
        }

        public static bool InsertPurRejectedOrderItem(List<PurRejectedOrderItemEntity> objPurRejectedOrderItemEntityList)
        {
            return DataAccess.Insert(objPurRejectedOrderItemEntityList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objPurRejectedOrderItemEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdatePurRejectedOrderItem(PurRejectedOrderItemEntity objPurRejectedOrderItemEntity)
        {
            return DataAccess.Update(objPurRejectedOrderItemEntity);
        }

        public static bool UpdatePurRejectedOrderItem(List<PurRejectedOrderItemEntity> objPurRejectedOrderItemEntityList)
        {
            return DataAccess.Update<PurRejectedOrderItemEntity>(objPurRejectedOrderItemEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objPurRejectedOrderItemEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeletePurRejectedOrderItem(PurRejectedOrderItemEntity objPurRejectedOrderItemEntity)
        {
            return DataAccess.Delete(objPurRejectedOrderItemEntity);
        }

        public static bool DeletePurRejectedOrderItem(List<PurRejectedOrderItemEntity> objPurRejectedOrderItemEntityList)
        {
            return DataAccess.Delete<PurRejectedOrderItemEntity>(objPurRejectedOrderItemEntityList);
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetPurRejectedOrderItemAll()
        {
            return DataAccess.SelectAllDataSet<PurRejectedOrderItemEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<PurRejectedOrderItemEntity> GetPurRejectedOrderItemAllList()
        {
            return DataAccess.SelectAll<PurRejectedOrderItemEntity>();
        }
        #endregion

        #region Functions
        public static DataTable GetDtAllByOrderID(string sOrderID)
        {
            string sql = @"select proi.*,mp.PRODUCT_NAME,mp.PRODUCT_CODE,mp.DESCRIPTION 
from PUR_REJECTED_ORDER_ITEM proi
left join PUR_PURCHASE_ARRIVED_ITEM ppai on proi.ARRIVED_ITEM_ID=ppai.ARRIVED_ITEM_ID
left join PUR_PURCHASE_ORDER_ITEM ppoi on ppai.PURCHASE_ITEM_ID=ppoi.PURCHASE_ITEM_ID
left join MST_PRODUCT mp on ppoi.PRODUCT_ID=mp.PRODUCT_ID
where 1=1 and proi.REJECTED_ORDER_ID='" + sOrderID + "'";
            return DataAccess.SelectDataSet(sql).Tables[0];
        }
        #endregion
    }
	
	
}	

